package com.usian.controller;

import com.usian.pojo.vo.LoginReqVo;
import com.usian.service.AdminService;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.usian.common.Result;

/**
 * @TODO:
 * @Author:baimu
 * @Date:2025 02 26 15 14
 **/
@RestController
@CrossOrigin
@Slf4j
public class AdminController {


    @Autowired
    AdminService adminService;


    /**
     * @RequestBody: 将请求体中的json数据封装到对象中 json字符串 转化成对象
     * @param loginReqVo
     * @return
     */
    @PostMapping("/login")
    public Result login(@Valid @RequestBody LoginReqVo loginReqVo) throws Exception {
        log.info("loginReqVo:{}", loginReqVo);

        return adminService.login(loginReqVo);
    }


}
